package com.imcode;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class ReaderDemo01 {
    public static void main(String[] args) throws IOException {
        //1.创建一个按字符读取文件的对象
        Reader fr = new FileReader("D:\\file\\fw.txt");
        //一次读取一个字符
        /*
        System.out.println(fr.read());//97
        System.out.println(fr.read());//98
        System.out.println(fr.read());//99
        System.out.println(fr.read());//20013
        System.out.println(fr.read());//22269
        System.out.println(fr.read());//-1 文件内容读取结束返回-1*/

        int i = 0;
        while ((i = fr.read()) != -1) {
            System.out.println((char) i);
        }
        fr.close();
    }
}
